﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NLite.Internal;
using NLite.Validation.DataAnnotations;


namespace NLite.Validation
{
    /// <summary>
    /// 
    /// </summary>
    public static class Validator
    {
        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <param name="entity"></param>
        /// <returns></returns>
        public static IErrorState Validate<TEntity>(TEntity entity)
        {
            if (entity == null)
                throw new ArgumentNullException("entity");

            return new NLite.Validation.DataAnnotations.EntityValidator<TEntity>().Validate(entity);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <param name="map"></param>
        /// <returns></returns>
        public static IErrorState Validate<TEntity>(IDictionary<string, string> map)
        {
            return new NLite.Validation.DataAnnotations.EntityValidator<TEntity>().Validate(map);
        }

       
    }
}
